<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>微信扫描登陆</title>
    <script src="js/vue.js"></script>
    <script src="js/axios.js"></script>
    <script src="js/common.js"></script>
</head>
<body>
<div id="app">
<span>登陆成功</span>
</div>
</body>
<script type="application/javascript">
    new Vue({
        el:"#app",
        data:{

        },
        methods:{

        },
        mounted(){
            let url = location.href;
            let map = parseUrlParams2Obj(url);
            this.$http.get("/wechat/login/"+map.code).then(res=>{
                if(res.data.success){
                    localStorage.setItem('user', JSON.stringify(res.data.resultObj.user));
                    localStorage.setItem('token', res.data.resultObj.token);
                    location="index.html"
                }else {
                    let openId=res.data.resultObj
                    location="bind.html?openId="+openId;
                }
            })
        }
    })
</script>
</html>